
<%@page import="com.keta.foundation.entity.Organization"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" trimDirectiveWhitespaces="true"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include.inc.jsp"%> 

<%!
	public String getTreeHTML(List<Organization> organizationList) {
		if(organizationList.isEmpty())
			return "";
		
		StringBuffer builder = new StringBuffer();
		builder.append("<ul>");
		for(Organization organization : organizationList){
			builder.append("<li><a href=\"javascript:\" onclick=\"$.bringBack({id:'" + organization.getId() + "', name:'" + organization.getName() + "'})\">" + organization.getName() + "</a>" + "\n");
			builder.append(getTreeHTML(organization.getChildren()));
			builder.append("</li>" + "\n");
		}
		builder.append("</ul>");
		return builder.toString();
	}
%>
<%
	List<Organization> orgList = (List<Organization>)request.getAttribute("orgList");
	String tree = getTreeHTML(orgList);
%>


<div class="pageContent">
	<div class="pageFormContent" layoutH="58">
		<ul class="tree expand">
			<li><a href="javascript:" onclick="$.bringBack({id:'1', name:'全部组织'})">全部组织</a>
			<%=tree %>
			</li>
		</ul>
	</div>
	
	<div class="formBar">
		<ul>
			<li><div class="button"><div class="buttonContent"><button class="close" type="button">关闭</button></div></div></li>
		</ul>
	</div>
</div>